<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopUserIdentityCard extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_user_identity_card', function (Blueprint $table) {
            $table->id();

            $table->string('orderNo', 60)->default('')->comment('订单号');
            $table->string('frontSideImg', 120)->default('')->comment('身份证正面图');
            $table->string('backSideImg', 120)->default('')->comment('身份证背面图');
            $table->string('name', 11)->default('')->comment('身份证姓名');
            $table->string('identityCardNumber', 19)->default('')->comment('身份证号码');
            $table->unsignedTinyInteger('gender')->default('0')->comment('性别 0:女性 1:男性');
            $table->unsignedInteger('effectiveStartTime')->default(0)->comment('身份证有效期 - 开始时间');
            $table->unsignedInteger('effectiveEndTime')->default(0)->comment('身份证有效期 - 截止时间');
            $table->string('nativePlace', 12)->default('')->comment('籍贯');
            $table->string('nation', 12)->default('')->comment('民族');
            $table->string('birthday', 12)->default('')->comment('生日');
            $table->string('animalSign', 12)->default('')->comment('生肖');
            $table->string('constellation', 12)->default('')->comment('星座');


            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');

            $table->index(['identityCardNumber'], 'idx_identityCardNumber');
            $table->unique(['orderNo'], 'idx_orderNo');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '招商加盟 - 用户身份证信息';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_user_identity_card');
    }
}
